package cn.itsource.ymcc.feignclient.fallbackfactory;

import cn.itsource.ymcc.domain.CourseDoc;
import cn.itsource.ymcc.feignclient.SearchFeignClient;
import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;

import java.util.List;

public class SearchFeignClientFallbackFactory implements FallbackFactory<SearchFeignClient> {
    @Override
    public SearchFeignClient create(Throwable throwable) {
        return new SearchFeignClient() {
            @Override
            public JsonResult save(List<CourseDoc> courseDoc) {
                return JsonResult.error("保存失败");
            }

            @Override
            public JsonResult search(CourseDoc courseDoc) {
                return JsonResult.error("查询失败");
            }

            @Override
            public JsonResult delete(List<Long> courseIds) {
                return JsonResult.error("删除失败");
            }

            @Override
            public JsonResult selectOneByCourseId(Long courseId) {
                return JsonResult.error("获取课程信息失败");
            }

            @Override
            public JsonResult selectBatchById(List<Long> courseIds) {
                return JsonResult.error("获取课程信息失败");
            }
        };
    }
}
